using WpfApp1.DataAccess;
using WpfApp1.Models;

namespace WpfApp1.Services;

public class StudentService : IStudentService
{
    private readonly IStuDataAccess _isDataAccess;

    public StudentService(IStuDataAccess isDataAccess)
    {
        _isDataAccess = isDataAccess;
    }

    
    //获取所有学生信息
    public List<Student> GetStudents()
    {
        return _isDataAccess.GetStudents();
    }

    //根据id获取单个学生信息
    public Student? GetStudentByNumber(string studentNumber)
    {
        Console.WriteLine($"Student number: {studentNumber}");
        return _isDataAccess.GetStudentByNumber(studentNumber);
    }

    //修改学生信息(性别，年龄，所在系)
    public void UpdateStudent(Student student)
    {
        _isDataAccess.UpdateStudent(student);
    }

    //添加学生信息
    public void AddStudent(Student student)
    {
        _isDataAccess.AddStudent(student);
    }

    /**
     * 根据学生number删除学生
     */
    public void DeleteStudentByNumber(Student student)
    {
        _isDataAccess.DeleteStudentByNumber(student);
    }

    // 其他业务逻辑方法
}